﻿using System.Text.RegularExpressions;

namespace WishlistUtilities {
    public static class ValidationUtility {
        public static bool IsValidUrl(string url) {
            return Regex.IsMatch(url, @"http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?");
        }

        /// <summary>
        /// Returns true if the input string is a valid e-mail
        /// </summary>
        /// <param name="email"></param>
        /// <returns>True for valid e-mail, and false</returns>
        public static bool IsValidEmail(string email) {
            return Regex.IsMatch(email, @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
        }
    }
}